<%@page language="java" contentType="text/html; charset=UTF-8" isELIgnored="false" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="html" tagdir="/WEB-INF/tags" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<!DOCTYPE html>
<html>
<html:header title="新增进货退货单">

    <link rel="stylesheet" href="${baseUrl}css/public.css" media="all">

    <style type="text/css">
        a{
            color: #01AAED;
            text-decoration: none;
            font-size: 12px;
        }
        a:hover {
            color: #FF5722;
        }

        .save{
            cursor:pointer;
        }

        .no-border{
            border: 0 solid #ffffff;
            border-radius: 2px;
            background-color: #ffffff;
        }

        .no-border:hover{
            border: 1px solid #1E9FFF;
            border-radius: 2px;
        }

        .layui-table-cell {            overflow: visible !important;        }
        /* 使得下拉框与单元格刚好合适 */
        td .layui-form-select{
            margin-top: -10px;
            margin-left: -15px;
            margin-right: -15px;
        }
    </style>

    <script>
        jQuery(function () {
            fixTableOperatorButton();

            if (_businessSet.inTaxRateFlag) {
                $("#tax").parent().css("display","inline-block");
            }

            $(window).focus();
            window.addEventListener("keydown", function(e) {
                if (e.keyCode == 83 && (navigator.platform.match("Mac") ? e.metaKey : e.ctrlKey)) {
                    $("#save").click();
                    e.preventDefault();
                }else if (e.keyCode == 119){
                    $("#realAmt").focus();
                    scrollToElement($("#realAmt"));
                    e.preventDefault();
                }
            }, false);


            getByType("${baseUrl}",ORDER_TYPE.JTD.type, $("[name='no']"));


            ajaxSelect("${baseUrl}user/user/getAll.action","userId");
            ajaxSelect("${baseUrl}settAccount/settAccount/listVo.action","settAccountId");
            $("[name='date']").val(GMTToDate(new Date()));
            $("#cancel").click(function () {
                closeSubIframe();
            });

            $(".save").click(function () {
                $("#save").click();
            });
            $("#save").click(function () {
                $("[lay-filter='save']").click();
            });

            $(".select-inGoods").click(function (e) {
                renderTable([]);
                let url = "${baseUrl}select/selectInGoods.action";
                openBigHtmlDialog("选择进货单", url);
            });

            $(".select-goods").click(function () {
                let houseId = $("[name='houseId']").val();
                if (houseId == ""){
                    errTip("请选择入库仓库");
                    return;
                }
                let url = "${baseUrl}select/selectGoods.action?houseId="+houseId+"&priceFlag=1";
                if (_businessSet.houseInOut == "" || _businessSet.houseInOut == "false"){
                    url += "&numberBar=2&checkStock=1";
                }
                openBigHtmlDialog("选择商品", url, function (layero, index) {
                    var iframe = window[layero.find('iframe')[0]['name']];
                    iframe.setUsedSnMap(genGoodsSnMap(layui.table.cache.table));
                });
            });

        });

        layui.use(['form', 'table', 'laydate'], function () {
            let $ = layui.jquery,
                form = layui.form,
                table = layui.table,
                laydate = layui.laydate,
                util = layui.util;

            laydate.render({
                elem: '#date'
            });

            renderTable([]);




            $("#otherAmt").val(getPrice("0"));
            $("#realAmt").val(getPrice("0"));
            $("#totalAmount").html(getPrice("0"));

            $("#otherAmt").blur(function () {
                let amt = genAmount($(this).val());
                $(this).val(getPrice(amt));
                setTotalAmount();
                processTotalRow();
            });

            // 监听修改update到表格中
            form.on('select(unitSelect)', function (data) {
                let index = $(data.elem).parents('tr').data('index');
                let tableData = layui.table.cache.table;
                let goodsUnitVo = genUnitVo(tableData[index].goodsUnitVoList, data.value);
                $(data.elem).parents('tr').find(".price").val(getPrice(goodsUnitVo.referBuyPrice));
                $(data.elem).parents('tr').find(".subjectPrice").html("进货价："+getPrice(goodsUnitVo.referBuyPrice));
                $(data.elem).parents('tr').find(".subjectPrice").attr("price",getPrice(goodsUnitVo.referBuyPrice));

                tableData[index].unitId = data.value;
                tableData[index].price = goodsUnitVo.referBuyPrice;
                tableData[index].times = goodsUnitVo.times;
                let stockNum = parseInt(tableData[index].baseStockNum/goodsUnitVo.times);
                tableData[index].stockNum = stockNum;
                processAmount($(data.elem));
                processTotalRow();
            });

            form.verify({
                userId: function(value, item){ //value：表单的值、item：表单的DOM对象
                    if(value == null || value==""){
                        return '经办人不能为空';
                    }
                },
                date: function(value, item){ //value：表单的值、item：表单的DOM对象
                    if(value == null || value==""){
                        return '业务日期不能为空';
                    }
                }
            });


            form.on('submit(save)',function (data) {
                if (table.cache.table.length == 0) {
                    errTip("未选择任何商品");
                    return false;
                }
                if (data.field.houseId == ""){
                    errTip("入库仓库不能为空");
                    return false;
                }

                if (data.field.providerId == ""){
                    errTip("供应商不能为空");
                    return false;
                }


                let tableData = table.cache.table;
                for (let i=0;i<tableData.length;i++) {
                    if (tableData[i].sn && (_businessSet.houseInOut == "" || _businessSet.houseInOut == "false")) {
                        if (tableData[i].goodsSnList == undefined || tableData[i].goodsSnList.length==0) {
                            errTip("商品("+tableData[i].name + ")的序列号数量不能为0");
                            return ;
                        } else if(tableData[i].goodsSnList.length != tableData[i].number) {
                            errTip("商品("+tableData[i].name + ")的序列号数量与数量不一致");
                            return ;
                        } else if (tableData[i].goodsSnList.length > tableData[i].maxNumber) {
                            errTip("商品("+tableData[i].name + ")的序列号数量不能大于剩余退货数量");
                            return ;
                        }
                    } else {
                        if (tableData[i].number == 0) {
                            errTip("商品("+tableData[i].name + ")的数量不能为0");
                            $("tr[data-index='"+i+"']").find(".number").css("border-color","red");
                            return ;
                        } else if (tableData[i].maxNumber!=undefined && tableData[i].number > tableData[i].maxNumber) {
                            errTip("商品("+tableData[i].name + ")的数量不能大于剩余退货数量");
                            $("tr[data-index='"+i+"']").find(".number").css("border-color","red");
                            return ;
                        }
                    }
                }

                //
                let entity = data.field;
                delete entity.providerName;
                delete entity.houseName;
                delete entity.inGoodsNo;
                delete entity.provider;
                delete entity.number;
                delete entity.price;
                delete entity.unitId;
                delete entity.amount;
                delete entity.storeId;
                entity.totalAmt = $("#totalAmount").html();

                if (_businessSet.inTaxRateFlag){
                    entity.tax = $("#tax").html();
                }

                entity.image = getImageNames();
                entity.date = genDate(entity.date);

                //经货单商品
                let list = new Array();
                let goodsSnList = [];
                $.each(table.cache.table,function (i,d) {
                    let vo = {};
                    vo.inGoodsGoodsId = d.inGoodsGoodsId;
                    vo.goodsId = d.goodsId;
                    vo.goodsId = d.goodsId;
                    vo.unitId = d.unitId;
                    vo.times = d.times;
                    vo.price = d.price;
                    vo.number = d.number;
                    vo.amount = d.amount;
                    vo.remark = d.remark;
                    vo.goodsSnList = genUploadTableList(d.goodsSnList);
                    list.push(vo);
                });
                entity.inGoodsRefundGoodsVoList = list;

                console.log(JSON.stringify(entity));
                tipLoad("进货退货新增中...");
                post("${baseUrl}inGoods/inGoodsRefund/add.action", entity, function (res) {
                    closeAll();
                    if (res.code == 1) {
                        tip(res.msg);
                        setTimeout(function () {
                            refreshMainIframe("${baseUrl}inGoods/inGoods.action");
                            refreshHouseWaitOut();
                            refreshMainIframe("${baseUrl}inGoods/inGoodsRefund.action");
                            closeSubIframe();
                        },800);
                    } else {
                        errTip(res.msg);
                    }
                });
                return false;
            });
        });

        function renderTable(list) {
            layui.table.render({
                id:'table',
                elem: '#table',
                height: 300,
                data:list,
                totalRow:true,
                text: {
                    none: '未选择商品' //默认：无数据。注：该属性为 layui 2.2.5 开始新增
                },
                cols: [[
                    {type:'numbers'},
                    {field: 'name', minWidth: 140, title: '名称/规格',style:"font-size:12px;",templet:function (d) {
                            return genGoodsName(d.name,d.norms)
                        }},
                    {field: 'no', width: 140, title: '商品编号',style:"font-size:12px;"},
                    {field:'number', width: 90, title: '数量',templet:"#numberBar"},
                    {width: 120, title: '单位',style:"font-size:12px;", templet:function (d) {
                        if (d.unitReadOnly!=undefined && d.unitReadOnly){
                            return d.goodsId == null ? "" : genUnitName(d.goodsUnitVoList,d.unitId);
                        } else {
                            return d.goodsId == null ? "" : genSelectUnit(d.unitId, d.goodsUnitVoList);
                        }
                    }},
                    {field: 'price', width: 90, title: '单价',templet:'#priceBar'},
                    {field: 'amount', width: 90, title: '金额',style:"font-size:12px;",templet:"#amountBar"},
                    {width: 110, title: '序列号',templet: "#snNumberBar"},
                    {field: 'remark', width: 120, title: '备注',style:"font-size:12px;",edit:"text"},
                    {title: '操作', minWidth: 70, fixed:'right', templet: '#operBar'},

                ]],
                limit: Number.MAX_VALUE,
                done: function(res, curr, count){

                    $(".snNumberDiv").unbind().bind('click',function () {
                        let index = $(this).parents('tr').data('index');
                        let tableData = layui.table.cache.table;
                        showSnList(tableData[index].name, tableData[index].goodsSnList);
                    });

                    $(".priceDiv").unbind("mouseenter").bind("mouseenter", function() {
                        $(this).find(".priceListDiv").css("display","block");
                    });
                    $(".priceDiv").unbind("mouseleave").bind("mouseleave", function() {
                        $(this).find(".priceListDiv").css("display","none");
                    });

                    $(".subjectPrice").unbind("click").bind("click", function () {
                        $(this).parents(".priceDiv").find(".priceListDiv").css("display","none");
                        let price = $(this).attr("price");
                        $(this).parents(".priceDiv").find(".price").val(price);

                        let index = $(this).parents('tr').data('index');
                        let tableData = layui.table.cache.table;
                        tableData[index].price = price;
                        processAmount($(this));
                        processTotalRow();
                    });

                    $(".price").unbind("blur").bind("blur",function () {
                        $(this).val(getPrice($(this).val()));
                        let index = $(this).parents('tr').data('index');
                        let tableData = layui.table.cache.table;
                        tableData[index].price = getPrice($(this).val());
                        processAmount($(this));
                        processTotalRow();
                    });

                    $(".amount").unbind("blur").bind("blur",function () {
                        setAmount(genAmount($(this).val()), $(this));
                        processTotalRow();
                    });

                    $(".number").unbind("blur").bind("blur",function () {
                        let $input=$(this);
                        let number = genNumber($input.val());
                        checkNumber(number,$input);
                        processNumber(number, $input);
                        processTotalRow();
                    });

                    $(".numberSn").unbind("click").bind("click",function () {
                        snIndex = $(this).parents('tr').data('index');
                        let goodsId = layui.table.cache.table[snIndex].goodsId;
                        console.log("houseId:${houseId}");
                        console.log("goodsId:"+goodsId);
                        let houseId = $("[name='houseId']").val();
                        if (houseId == "" ) {
                            errTip("请选择仓库");
                            return;
                        }
                        openHtmlDialog("管理序列号","${baseUrl}dialog/sn/select.action?type=2&houseId="+houseId+"&goodsId="+goodsId, function (layero, index) {
                            var iframe = window[layero.find('iframe')[0]['name']];
                            let goodsSnList = layui.table.cache.table[snIndex].goodsSnList;
                            if (emptyList(goodsSnList)) {
                                goodsSnList=[];
                            }
                            iframe.setDataToTable(goodsSnList,genGoodsSnMap(layui.table.cache.table));
                        });
                    });

                    setTotalAmount();
                    processTotalRow();
                }
            });

            layui.table.on('tool(table)', function (obj) {
                if (obj.event === 'delete') {
                    operator_del(obj);
                }
            });
        }

        /**
         * 开启sn号的商品，选择完序列号会回调这个
         *
         */
        function processSnSelect(data) {
            layui.table.cache.table[snIndex].number = data.length;
            layui.table.cache.table[snIndex].goodsSnList = data;
            let child = data.length + '个';
            $("tr[data-index='"+snIndex+"']").find(".snNumberDiv").html(child);
            processNumber(data.length, $("tr[data-index='"+snIndex+"']").find(".number"));
            processTotalRow();
            $(window).focus();
        }

        /**
         * 如果使用商品选择窗口，必须实现此函数，否则取不到已选择的商品数据
         * @param data
         */
        function getSelectGoods(data) {
            //处理显示数据
            $.each(data,function (i,d) {
                d.goodsId = d.id;
                layui.table.cache.table.push(d);
            });

            renderTable(layui.table.cache.table);
            $(window).focus();
        }

        /**
         *当仓库改变时会回调这个函数
         */
        function houseChange(houseId,oldHouseId) {
            $(window).focus();
            if (oldHouseId != "" && layui.table.cache.table.length > 0) {
                let flag = 1;
                $.each(layui.table.cache.table, function (i,d) {
                    if (d.goodsSnList != null) {
                        d.goodsSnList = null;
                        flag=2;
                    }
                });

                renderTable(layui.table.cache.table);
                if (flag == 2) {
                    tip("仓库被修改,序列号被清空");
                }
            }
        }

        /**
         * 必须实现，供根据条码或编号取得商品信息所调用
         * @param data
        */
        function processGoods(data) {
            $(window).focus();
            if (!hasId(layui.table.cache.table, data.id)) {
                let houseId = $('[name="houseId"]').val();
                if (houseId==''){
                    errTip('请先选择出库仓库');
                    return;
                }

                layui.table.cache.table.push(data);
                reloadGoodsTable();
            }
            $(window).focus();
        }


        function processTotalRow() {
            let amount=0;
            let number = 0;
            $.each(layui.table.cache.table, function (i,d) {
                number += parseInt(d.number);
                amount += parseFloat(d.amount);
            });
            setTotalRowWithCenter("amount",getPrice(amount));
            setTotalRowWithCenter("number",number);
            setTotalRow("1","合计");
        }

        function checkNumber(number,$input) {
            let index = $input.parents('tr').data('index');
            let tableData = layui.table.cache.table;
            let maxNumber = tableData[index].maxNumber;

            if (number == 0) {
                errTip("数量必须大于0");
                $input.css("border-color","red");
            } else if(maxNumber!=undefined && number > maxNumber){
                errTip("不能大于剩余退货数量");
                $input.css("border-color","red");
            } else {
                $input.css("border-color","#ffffff");
            }
        }
    </script>

</html:header>
<body>

<div id="headButton" style="display:none;width: 100%; margin-bottom: 20px;overflow: hidden;" >
    <div class="layui-inline selectGoodsDiv">
        <button class="layui-btn select-goods">选择商品</button>
        <html:getGoodsByCode/>
    </div>

    <div style="float: right;">
        <button id="save" class="layui-btn">保存</button>
        <button class="layui-btn layui-btn-primary" id="cancel">取消</button>
    </div>
</div>


<div class="layuimini-container">
    <div class="layuimini-main">

        <div id="selectLinkOrNoLinkDiv" style="padding-top: 20px;">
            <h2 style="width: 100%;text-align: center;">进货退货单</h2>
            <div style="height: 4px;background-color: #bbbbbb;width: 100%;margin: 20px 0 2px 0;"></div>
            <div style="height: 1px;width: 100%;background-color: #dddddd;margin-bottom: 10px;"></div>
            <div style="height: 10px;"></div>

            <div style="width: 100%;text-align: center;">
                <i class="layui-icon layui-icon-form" style="font-size: 200px;color: #bbbbbb"></i>
            </div>

            <div style="width: 100%;text-align: center;color: #bbbbbb;font-size: 30px;">
                您可以关联进货单退货,也可以直接选择商品进行退货。
            </div>

            <div style="width: 100%;text-align:center;padding: 30px 0 60px 0">
                <a class="layui-btn" id="btnLinkInGoods">关联进货单</a>
                <a class="layui-btn layui-btn-primary" id="btnNotLinkInGoods">不关联进货单</a>
            </div>
            <script>
                $("#btnLinkInGoods").click(function () {
                    renderTable([]);
                    let url = "${baseUrl}select/selectInGoods.action";
                    openBigHtmlDialog("选择进货单", url);
                });

                function getSelectInGoods(data) {
                    //console.log(JSON.stringify(data));
                    $("#infoDiv").css("display","block");
                    $("#headButton").css("display","block");
                    $("#selectLinkOrNoLinkDiv").css("display","none");

                    $(".selectGoodsDiv").css("display","none");
                    $(".inputCode").css("display","none");
                    $(".selectProviderDiv").hide();
                    $(".selectHouseDiv").hide();
                    $(".houseAndProviderNameDiv").css("display","inline");
                    $(".selectInGoodsDiv").css("display","inline");



                    get("${baseUrl}inGoods/inGoods/getVoByIdWithCanRefundNumber.action?id="+data.id, function (res) {
                        if (res.code == 1) {
                            let data = res.data;
                            $('[name="inGoodsId"]').val(data.id);
                            $("#providerName").val(data.provider.name);
                            $('[name="providerId"]').val(data.provider.id);
                            $("#houseName").val(data.houseVo.store.name + ">" + data.houseVo.name);
                            $('[name="houseId"]').val(data.houseVo.id);
                            $("#inGoodsNo").val(data.no);

                            let list=[];
                            $.each(data.inGoodsGoodsVoList, function (i,d) {
                                if (d.refundNumber < d.number) {
                                    let vo = d.goodsVo;
                                    vo.inGoodsGoodsId = d.id;
                                    vo.goodsId = d.goodsId;
                                    vo.number = d.number-d.refundNumber; //剩余可退货最大数量
                                    vo.maxNumber = d.number-d.refundNumber;//剩余可退货最大数量
                                    vo.baseStockNum = d.baseStockNum;
                                    vo.stockNum = d.stockNum;
                                    vo.price = d.price;
                                    vo.unitId = d.unitId;
                                    vo.times = d.times;
                                    vo.unitReadOnly = true;
                                    vo.amount = d.amount;
                                    vo.remark = d.remark;
                                    delete vo.goodsSnList;
                                    list.push(vo);
                                }
                            });
                            if (list.length == 0) {
                                errTip("该销售单已经全部退货或还有待出库单未出库");
                            }
                            renderTable(list);
                        }else {
                            errTip("获取订单信息失败");
                        }
                    });


                }

                $("#btnNotLinkInGoods").click(function () {
                    $("#infoDiv").css("display","block");
                    $("#headButton").css("display","block");
                    $("#selectLinkOrNoLinkDiv").css("display","none");
                });
            </script>
        </div>

        <div id="infoDiv" style="display: none">

            <h2 class="tableBeforeTitle">进货退货单</h2>
            <div style="height: 4px;background-color: #bbbbbb;width: 100%;margin: 20px 0 2px 0;"></div>
            <div style="height: 1px;width: 100%;background-color: #dddddd;margin-bottom: 10px;"></div>
            <div style="height: 10px;"></div>


            <div class="layui-form-item">
                <div class="layui-inline selectInGoodsDiv" style="display: none;">
                    <div class="label">进货单号</div>
                    <div style="display: inline-block;width: 160px;">
                        <input type="text" id="inGoodsNo" name="inGoodsNo" class="layui-input readonly" readonly style="font-size: 12px;">
                    </div>

                    <div style="display: inline-block;">
                        <button class="layui-btn layui-btn-normal select-inGoods">重选</button>
                    </div>
                </div>
            </div>

            <form class="layui-form layui-form-pane" action="" lay-filter="form">
                <input type="hidden" name="close" value="false">
                <input type="hidden" name="inGoodsId">
                <button style="display: none;" lay-submit lay-filter="save" class="layui-btn">保存</button>

                <div class="layui-form-item">
                    <div class="layui-inline" style="margin-bottom: 4px;">
                        <div class="label">编号</div>
                        <div style="display: inline-block;width: 160px;">
                            <input type="text" id="no" name="no" class="layui-input readonly" readonly style="font-size: 12px;">
                        </div>
                    </div>


                    <div class="houseAndProviderNameDiv" style="display: none">
                        <div class="layui-inline" style="margin-bottom: 4px;">
                            <div class="label">出库仓库</div>
                            <div style="display: inline-block;width: 160px;">
                                <input type="text" id="houseName" name="houseName" class="layui-input readonly" readonly style="font-size: 12px;">
                            </div>
                        </div>

                        <div class="layui-inline" style="margin-bottom: 4px;">
                            <div class="label">供应商</div>
                            <div style="display: inline-block;width: 160px;">
                                <input type="text" id="providerName" name="providerName" class="layui-input readonly" readonly style="font-size: 12px;">
                            </div>
                        </div>
                    </div>

                    <html:selectHouse label="出库仓库" formFilter="form" showDefault="1"/>
                    <html:selectProvider/>

                    <div class="layui-inline" style="margin-bottom: 4px;">
                        <div class="label">业务日期</div>
                        <div style="display: inline-block;width: 160px;">
                            <input type="text" name="date" id="date" lay-verify="date" autocomplete="off" class="layui-input">
                        </div>
                    </div>

                    <div class="layui-inline" style="margin-bottom: 4px;">
                        <div class="label">经手人</div>
                        <div style="display: inline-block;width: 160px;">
                            <select name="userId" lay-verify="userId" lay-filter="userId">
                            </select>
                        </div>
                    </div>
                </div>


                <div style="height: 20px;"></div>

                <table class="layui-hide" id="table" lay-filter="table" lay-size="sm"></table>

                <div style="overflow: auto;margin-top: -10px">
                    <table class="layui-table" style="margin: 0;min-width: 600px;">
                        <colgroup>
                            <col>
                            <col width="300">
                        </colgroup>
                        <tbody>
                        <tr>
                            <td>
                                <div style="float: right;">
                                    <div class="layui-inline" style="text-align: left; width: 100px;display: none">
                                        税额<span id="tax" style="padding-left: 10px;">0.00</span>
                                    </div>

                                    <div class="layui-inline">
                                        <div class="bottomLabel">其他费用</div>
                                        <div class="bottomContent">
                                            <input type="number" name="otherAmt" id="otherAmt" value="100" class="layui-input no-border" style="text-align:center ">
                                        </div>
                                    </div>
                                </div>
                            </td>
                            <td style="background-color: #FFFFCC;">
                                <div style="display: inline-block;height: 38px;line-height: 38px;width: 80px;">结算账户</div>
                                <div class="layui-input-inline" style="margin: 10px 15px 0px 15px;width: 130px;">
                                    <select name="settAccountId" lay-filter="settAccountId">
                                    </select>
                                </div>
                            </td>
                        </tr>

                        <tr>
                            <td>
                                <div style="text-align: right;font-size:16px;font-weight:bold;height: 38px;line-height: 38px;">
                                    总计金额:<span id="totalAmount" style="color: #FF5722">0</span>元
                                </div>
                            </td>
                            <td style="background-color: #FFFFCC;max-width: 300px;">

                                <div style="display: inline-block;height: 38px;line-height: 38px;width: 80px;">实退金额</div>
                                <div class="layui-input-inline" style="width: 160px;">
                                    <input type="number" id="realAmt" name="realAmt" class="layui-input" >
                                </div>
                            </td>
                        </tr>

                        <tr>
                            <td>
                                <div style="position: relative;">
                                    <input type="text" id="remark" name="remark" class="layui-input no-border" style="padding-left: 60px;">
                                    <div style="position: absolute;top: 10px;left: 10px;">
                                        备注:
                                    </div>
                                </div>
                            </td>
                            <td class="save" style="background-color: #1E9FFF;color:#ffffff;text-align: center;font-size: 16px;">保存(ctrl+s)</td>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </form>

            <div class="layui-form-item" style="padding-top: 20px;">
                <label class="layui-form-label">图片附件</label>
                <html:imageAnnex type="inGoodsRefund" update="false"
                                 uploadUrl="${baseUrl}inGoods/inGoodsRefund/uploadImg.action"
                                 updateUrl="${baseUrl}inGoods/inGoodsRefund/updateImage.action"/>
            </div>
        </div>

    </div>


</div>

</body>

<script type="text/html" id="operBar">
    <a class="layui-btn layui-btn-xs layui-btn-danger table-operator" lay-event="delete">删除</a>
</script>

<script type="text/html" id="numberBar" >
    <div class="numberDiv">
        {{# if(d.sn==true && (_businessSet.houseInOut == "" || _businessSet.houseInOut == "false")){ }}
        <span class="number">{{ getNumber(d.number) }}</span>
        <span class="numberSn">sn</span>
        {{# }else{ }}
        <input type="number" name="number" class="layui-input number" value="{{ getNumber(d.number) }}" style="background: #ffffff">
        {{# } }}
    </div>
</script>

<script type="text/html" id="snNumberBar" >
    {{# if(d.sn==true && (_businessSet.houseInOut == "" || _businessSet.houseInOut == "false")){ }}
    {{# if(d.goodsSnList!=null && d.goodsSnList.length > 0){ }}
    <div class="snNumberDiv">{{d.goodsSnList.length}}个</div>
    {{# }else{ }}
    <div class="snNumberDiv">0个</div>
    {{# } }}
    {{# } }}
</script>

<script type="text/html" id="amountBar" >
    <div class="numberDiv">
        <input type="number" name="amount" value="{{ getPrice(d.amount) }}" class="layui-input amount">
    </div>
</script>

<script type="text/html" id="priceBar" >
    <div class="priceDiv">
        <input type="number" name="price" value="{{ getPrice(d.price) }}" class="layui-input price">

        <div class="priceListDiv">
            <ul>
                {{# if(d.unitId!=undefined){ }}
                <li class="subjectPrice" price="{{ getPrice(genUnitVo(d.goodsUnitVoList,d.unitId).referBuyPrice) }}">
                    进货价:{{ getPrice(genUnitVo(d.goodsUnitVoList,d.unitId).referBuyPrice) }}
                </li>
                {{# } }}
            </ul>
        </div>
    </div>
</script>
<html:snListDialog/>
<html:loading/>
</html>